package com.terrier.ui.skins.skinBaseClasses
{
    import com.terrier.ui.skins.IWxLabelSkin;
    import com.terrier.ui.skins.WxAssetUtility;
    import com.terrier.ui.skins.WxFlaSkinUtility;
    import com.terrier.ui.skins.WxTextStyle;

    import flash.display.DisplayObject;
    import flash.display.Sprite;

    public class WxLabelSkinBase implements IWxLabelSkin
    {
        protected var _bg:DisplayObject;

        protected var _labelStyle:WxTextStyle;

        protected var _leftPad:int;

        protected var _rightPad:int;

        protected var _topPad:int;

        protected var _bottomPad:int;

        public function WxLabelSkinBase()
        {
        }

        public function get bg():DisplayObject
        {
            return _bg;
        }

        public function get labelStyle():WxTextStyle
        {
            return _labelStyle;
        }

        public function get leftPad():int
        {
            return _leftPad;
        }

        public function get rightPad():int
        {
            return _rightPad;
        }

        public function get topPad():int
        {
            return _topPad;
        }

        public function get bottomPad():int
        {
            return _bottomPad;
        }

        public function get customLayout():Boolean
        {
            return false;
        }

        public function get width():Number
        {
            return _bg != null ? _bg.width : 0;
        }

        public function set width(value:Number):void
        {
            _bg != null ? _bg.width = value : 0;
        }

        public function get height():Number
        {
            return _bg != null ? _bg.height : 0;
        }

        public function set height(value:Number):void
        {
            _bg != null ? _bg.height = value : 0;
        }

        public function initByAsset(asset:Sprite):void
        {
            if (asset == null || asset.numChildren == 0)
            {
                return;
            }

            _labelStyle = WxFlaSkinUtility.getTextStyle(asset, 1);

            _bg = WxFlaSkinUtility.getDisplayObject(asset, 2);
        }
    }
}
